|
| 07 Jul 2014 08:58 AM |
Water = script.Parent
function onTouch(hit) RL = hit.Parent:FindFirstChild("Right Leg") Player = hit.Parent LPlayer = Player:GetPlayerFromCharacter(Noob) if (RL ~= nil) then wait(0.1) Noob.PlayerGui.WaterSplash:Play() for i=4,9 do local splash = Instance.new("Part") splash.Shape = 0 splash.formFactor = 3 splash.Size = Vector3.new(0.2,0.2,0.2) splash.BrickColor = BrickColor.new(23) splash.BottomSurface = 0 splash.TopSurface = 0 splash.CanCollide = false splash.Transparency = 0.3 local v = Vector3.new(math.random(-1,1), math.random(0,1), math.random(-2,1)) splash.Velocity = 35 * v splash.CFrame = CFrame.new(rl.Position + v, v) splash.Parent = game.Workspace end end end
Water.Touched:connect(onTouch)
-- That script is placed into Terrain. If someone touches terrain, its doing splash effect and it should play splash music from PlayerGui. Somehow it doesnt work. Output says : 15:58:30.835 - GetPlayerFromCharacter is not a valid member of Workspace 15:58:30.835 - Script 'Workspace.Terrain.Splash', Line 6 15:58:30.835 - Stack End 15:58:30.835 - Disconnected event because of exception |
|
|
| Report Abuse |
|
|
| 07 Jul 2014 09:00 AM |
| Add a check to make sure "hit" actually belongs to a player. |
|
|
| Report Abuse |
|
DataStore
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 8540 |
|
|
| 07 Jul 2014 09:03 AM |
GetPlayerFromCharacter is a method used on the players service, not models.
game.Players:GetPlayerFromCharacter(hit.Parent) |
|
|
| Report Abuse |
|