Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to move part from ReplicatedStorage to Workspace for only special player ?

Asked by 1 year ago

I have a folder with parts inside ReplicatedStorage and I want it to move to Workspace if a player touches a part, but only for the player that touched that part.

Here's the script:<

local planks = game.ReplicatedStorage.WoodPlanks
local sound = planks.SoundPlayer.Planks

script.Parent.Touched:connect(function(hit)
    if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
        planks.Parent = game.Workspace
        sound:Play()
    end
end)

2 answers

Log in to vote
0
Answered by 1 year ago

Make it so that in the local script it has an event for when a player touches a part, that event moves the part to the workspace. Doing this inside a local script in StarterPlayerScripts will be the easiest solution

Ad
Log in to vote
0
Answered by 1 year ago

Using a local script should do this, but '.Touched' might not work in local scripts. If that happens, use a remote event.

Answer this question