How to fix your broken ROBLOX Skateboard 2016 (Roblox InsertService updates broke them)
- SteadyOn
- Jan 1, 2017
- 2 min read
Happy new year! Firstly let me say sorry for the indentation on my code, I couldn't copy it with the indentation.
In November Roblox released plans to change the insertservice on the roblox developer forums. The changes that they then put into effect actually broke all roblox skateboards.
This is going to show you how to fix your skateboard if its not working and tell you about why it isn't working.
The fix is actually slightly more complicated than you might think. The update is centered around exploiter security.
The new changes mean that the client cannot insert an object without calling a RemoteEvent or RemoteFunction to a server script to then spawn the skateboard.
In other words, you can't spawn your skateboard from the one script in the skateboard, (a localscript) as ROBLOX does not allow you to do so. The best way of fixing this is using a server sided script and a RemoteEvent.
In many ways this is a useful update for you, as it means there will be more server sided processing, allowing you to have just one script which handles all of the skateboards in the server. Not only is this useful if you wanted to edit it, but it's also very useful for preventing exploiting.
The fix
Let me say sorry again for the indentation on my code, I couldn't copy it with the indentation. So it's all well and good understanding why it's broken. But this will show you how to fix it. Firstly, take your skateboard. It should have an ancestry similar to the picture below.

The names don't matter. Open the local script, in this example it is called "InsertBoard". This script will be very simple, remove it's current code, APART FROM THE FIRST LINE (the skateboard's id) and put this into it: (Make sure the first line of the original script saying "local skateboardId =" and then a number is still there.
local Tool = script.Parent;
function insert()
local skateboard = game.workspace:findFirstChild("requestSkateboard")
if skateboard ~= nil then
skateboard:FireServer(skateboardId)
end
end
enabled = true
function onButton1Down(mouse)
if not enabled then
return
end
enabled = false
insert()
wait(.01)
Tool:Remove()
end
function onEquippedLocal(mouse)
if mouse == nil then
print("Mouse not found")
return
end
mouse.Icon = "http://www.roblox.com/asset/?id=22858207"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
Tool.Equipped:connect(onEquippedLocal)
Now go to ServerScriptService and create a basic script. Place it into ServerScriptService and call it "Skateboards". Now enter this code into it:
local skateboardRequest = Instance.new("RemoteEvent")
local skateboardRequest = Instance.new("RemoteEvent")
local insService = game:GetService("InsertService")
skateboardRequest.Parent = game.workspace
skateboardRequest.Name = "requestSkateboard"
local function onRequestEvent(player, id)
local skateboard = insService:LoadAsset(id)
game:GetService("InsertService"):Insert(skateboard)
local Torso = player.Character:FindFirstChild("Torso")
if skateboard ~= nil then
local instances = skateboard:GetChildren()
skateboard.Name = player.UserId.."skateboard"
if #instances == 0 then
skateboard:Remove()
return
end
skateboard:MoveTo(Torso.Position + Torso.CFrame.lookVector * 8)
print("inserted and moved skateboard to character")
end
end
skateboardRequest.OnServerEvent:Connect(onRequestEvent)local skateboardRequest = Instance.new("RemoteEvent")
local insService = game:GetService("InsertService")
skateboardRequest.Parent = game.workspace
skateboardRequest.Name = "requestSkateboard"
local function onRequestEvent(player, id)
local skateboard = insService:LoadAsset(id)
game:GetService("InsertService"):Insert(skateboard)
local Torso = player.Character:FindFirstChild("Torso")
if skateboard ~= nil then
local instances = skateboard:GetChildren()
skateboard.Name = player.UserId.."skateboard"
if #instances == 0 then
skateboard:Remove()
return
end
skateboard:MoveTo(Torso.Position + Torso.CFrame.lookVector * 8)
print("inserted and moved skateboard to character")
end
end
skateboardRequest.OnServerEvent:Connect(onRequestEvent)
And that's it. It should work perfectly, but if it doesn't be sure to leave a comment and I'll respond.
コメント