What do you want to achieve? I’d like to make a Basepart that when touched, will make the player run faster.
What is the issue? I had already made this script and it works perfectly fine, but after duplicating the same Basepart, the duplicated part would stop working.
What solutions have you tried so far? I tried searching other similar topics but none works so far.
Code:
local brick = script.Parent
brick.Touched:Connect(function(otherPart)
print("touched")
local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
if humanoid then
print("Found hum")
humanoid.WalkSpeed = 70
end
end)
This might be because your TeamCreate is turned on and that you have not committed the script on drafts tab. You can find Drafts on View Tab in studio, search for it.
When a script is not committed and is duplicated, then the code inside would not duplicate.
If this is not the issue, you might want to look into output for errors, and let me know.
I’ve checked and its said that TeamCreate is not enabled, so it should’ve saved immediately. Another thing I found out is that the duplicated part works if I didn’t trigger the original Basepart.
Nope. Because the reason I had make this speed part was to be a send-off to a large jump that once they make it, they would return to the original 25 speed.
So the player’s speed is 25 before touching the part.
EDIT: So it turns out that one of my LocalScripts was changing the Humanoid.WalkSpeed via Client-Side and so caused it to not change properly when the Server-Script of the BasePart fired. All I did to fix this was to use a RemoteEvent and change the Humanoid.WalkSpeed via Server-Side. It works perfectly fine now!