eh what i told you should work, make sure you also did what hkep mentioned, and this aswell
local part = script.Parent → to → local part = game.Workspace.Part
eh what i told you should work, make sure you also did what hkep mentioned, and this aswell
local part = script.Parent → to → local part = game.Workspace.Part
l```
local part = game:GetService('Workspace').part
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
1, --Time the tween runs
Enum.EasingStyle.Linear, --The Easing Style of the tween
Enum.EasingDirection.Out, --The EasingDirection of the tween
0, --How many times the tween repeats
false, --if the tween will reverse
0 --How long it takes until the tween starts
)
local tween = TweenService:Create(part, tweenInfo, {Color = Color3.fromRGB(0, 255, 0)})
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstAncestorWhichIsA('Humanoid') then
tween:Play()
end
end)
yeah I did that but what I don’t understand:
you have made
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') == nil then return end
local playerwhotouched = game.Players:GetPlayerFromCharacter(hit.Parent)
if playerwhotouched == game.Players.LocalPlayer then
tween:Play()
end
end)
but if you dont have to place it in the part itself, then why do you use script.Parent.Touched? how does the script know what part you have to touch then?
local part = workspace.Part
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
1, --Time the tween runs
Enum.EasingStyle.Linear, --The Easing Style of the tween
Enum.EasingDirection.Out, --The EasingDirection of the tween
0, --How many times the tween repeats
false, --if the tween will reverse
0 --How long it takes until the tween starts
)
local tween = TweenService:Create(part, tweenInfo, {Color = Color3.fromRGB(0, 255, 0)})
part.Touched:Connect(function(hit)
tween:Play()
end)
^ the LocalScript named x was where the code was.
oh youre right my bad, it should be the part thats getting touched instead,
so:
local part = workspace.Part --or whatever the name of your part is
part.Touched:Connect(function() etc etc
well if i have done that, and i test it with 2 players the will both see the changes. maybe the server doesnt doesn’t see it, but all players are. and the script im trying to make is that only the player who touches the part see the change
in the image touches only 1 player the part but both players see the changes
yes this is it, thank you for helping me
The code I had to use is this one:
local part = game.Workspace.Part
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
1, --Time the tween runs
Enum.EasingStyle.Linear, --The Easing Style of the tween
Enum.EasingDirection.Out, --The EasingDirection of the tween
0, --How many times the tween repeats
false, --if the tween will reverse
0 --How long it takes until the tween starts
)
local tween = TweenService:Create(part, tweenInfo, {Color = Color3.fromRGB(0, 255, 0)})
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') == nil then return end
local playerwhotouched = game.Players:GetPlayerFromCharacter(hit.Parent)
if playerwhotouched == game.Players.LocalPlayer then
tween:Play()
end
end)
I want to thank everyone who has helped me with this!
i hope you’re having an amazing day!
Thanks again for helping me.